﻿using System;

namespace YXYLCommon
{
    [Serializable]
    public class DDLItem:BaseModel
    {
         public DDLItem()
            { }
            public DDLItem(string text,string value)
            {
                this.text = text;
                this.value = value;
            }
            private string text;
            public string Text
            {
                get
                {
                    return this.text;
                }
                set
                {
                    this.text = value;
                }
            }
            private string value;
            public string Value
            {
                get
                {
                    return this.value;
                }
                set
                {
                    this.value = value;
                }
            }
            public string ParentId { get; set; }
            public override BaseModel ToObject(System.Data.DataRow row)
            {
                this.IsExists = true;
                this.Text = Convert.ToString(row["TEXT"]);
                this.Value = Convert.ToString(row["VALUE"]);
                this.ParentId = row.Table.Columns.Contains("PARENTID") ? Convert.ToString(row["PARENTID"]) : null;
                return this;
            }

            public override string ToString()
            {
                return this.text;
            }
        }
    }
